/**
 * 人员选择树 types checkbox 多选, radio 单选 selectuseronly TreeAction.java 提供不同的选择方式
 */
// 控件出发对象
// 表单对象
var inputOBJ;
// 显示对象
var viewObj;

function selectPeople(object, types, imput_ID) {
	inputOBJ = $(imput_ID);
	viewObj = object;
	var url = context + "/system/tree.do?method=selectgrouptree&type=" + types;
	dialog(url, true, "选择公司部门", 300, 350);
}
/**
 * 人员选择回调函数 ids id字符串 names 中文名称字符串 types 未知
 */
function responseResult(ids, names, types) {

	if (inputOBJ != null) {
		inputOBJ.value = ids.substring(1);
	}
	viewObj.value = names;
	closeDialog();
}

/* 选择用户所属组 */
function handleSelect() {
	var url = context + "/system/tree.do?method=selectgrouptree&type=radio";
	dialog(url, true, "组织机构", 300, 400);
}

/* 保存提交 */
function handleSubmit() {
	var fj1 = document.getElementById("file1").value;
	var fj2 = document.getElementById("file2").value;
	var fj3 = document.getElementById("file3").value;
	var fj4 = document.getElementById("file4").value;
	var fj5 = document.getElementById("file5").value;
	// return false;
	if(isblank($('wjjsr_name'))){
		alert('请选择文件接收人');
	}else if (fj1 == "" && fj2 == "" && fj3 == "" && fj4 == "" && fj5 == "") {
		alert("请填写附件！");
	} else if (confirm("确定提交?")) {
		var myid = document.getElementById("wjjsr_id").value;
		var myname = document.getElementById("wjjsr_name").value;
		var mytype = document.getElementById("wjjsr_type").value;
		var mytime = document.getElementById("send_time").value;
		var myid_array = myid.split(",");
		var myname_array = myname.split(",");
		var mytype_array = mytype.split(",");

		var total_name = "";
		for (var i = 0; i < myid_array.length; i++) {
			createHidden("wjjsr_id_" + i, myid_array[i]);
			createHidden("wjjsr_name_" + i, myname_array[i]);
			createHidden("wjjsr_type_" + i, mytype_array[i]);
			createHidden("receive_time_" + i, mytime);
			createHidden("wjjs_status_" + i, "未接收");
			if (total_name == "") {
				total_name = i + "";
			} else {
				total_name = total_name + "," + i;
			}

		}
		document.getElementById("count").value = total_name;

		document.form1.submit();
	}
}

function init() {
	if (parent && parent.resizeFrame) {
		parent.resizeFrame(700);
	}
}